package com.jdk.learn.java8.bo;

import java.util.List;

/**
 * TODO
 *
 * @author bgt
 * @version V1.0
 * @since 2019-01-07 10:56
 */
public class Apple implements Comparable<Apple>{
    // 名称
    private String name;
    // 重量
    private Long weight;
    // 别名
    private List<String> place;

    public Apple() {
    }

    public Apple(String name, Long weight,List<String> place) {
        this.name = name;
        this.weight = weight;
        this.place = place;
    }

    public static Apple getInstance(String name, Long weight){
      return   new Apple(name,weight,null);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getWeight() {
        return weight;
    }

    public void setWeight(Long weight) {
        this.weight = weight;
    }

    public List<String> getPlace() {
        return place;
    }

    public void setPlace(List<String> place) {
        this.place = place;
    }

    @Override
    public String toString() {
        return "Apple{" +
                "name='" + name + '\'' +
                ", weight=" + weight +
                ", place=" + place +
                '}';
    }

    @Override
    public int compareTo(Apple o) {
        return o.getName().hashCode();
    }
}
